<template>
  <div>
    <el-breadcrumb separator="/">
      <el-breadcrumb-item :to="{ path: '/ZhiDingAndFenPei' }">巡检任务管理 </el-breadcrumb-item>
      <el-breadcrumb-item :to="{path:'/zhidinghuizhi'}">缺陷查询</el-breadcrumb-item>
    </el-breadcrumb>
    <el-form :model="form">
      <el-row :gutter="25">
        <el-col :span="6">
          <el-form-item label="任务名称" label-width="80px">
            <el-input v-model="form.xno" placeholder="任务名称"></el-input>
          </el-form-item>
        </el-col>

        <el-col :span="6">
          <el-form-item label="线路编号" label-width="80px">
            <el-input v-model="form.xno"></el-input>
          </el-form-item>
        </el-col>

        <el-col :span="6">
          <el-form-item label="缺陷类型" label-width="80px">
            <el-select v-model="value">
              <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value"></el-option>
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="缺陷级别" label-width="80px">
            <el-select v-model="value2">
              <el-option v-for="item in options2" :key="item.value" :label="item.label" :value="item.value"></el-option>
            </el-select>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row :gutter="25">
        <el-col :span="7">
          <el-form-item label="发现时间" label-width="50px">
            <el-date-picker v-model="form.findin"></el-date-picker>
            <el-date-picker v-model="form.findout"></el-date-picker>
          </el-form-item>
        </el-col>
        <el-col :span="7">
          <el-form-item label="下发时间" label-width="50px">
            <el-date-picker v-model="form.starttime"></el-date-picker>
            <el-date-picker v-model="form.stoptime"></el-date-picker>
          </el-form-item>
        </el-col>

        <el-col :span="6">
        </el-col>


        <el-col :span="4">
          <el-form-item>
            <el-button type="primary" size="medium" @click="chaxun()">查询</el-button>

          </el-form-item>
        </el-col>
      </el-row>
    </el-form>

    <!-- 显示后端数据 -->
    <el-table :data="tableDate">
      <el-table-column label="巡检任务编号" prop="xunjianrwid"></el-table-column>
      <el-table-column label="任务编号" prop="rwid"></el-table-column>
      <el-table-column label="杆塔编号" prop="gtid"></el-table-column>

      <el-table-column label="缺陷级别" prop="qxlv"></el-table-column>
      <el-table-column label="缺陷类型" prop="qxtype"></el-table-column>
      <el-table-column label="发现人" prop="findUser"></el-table-column>
      <el-table-column label="发现时间" prop="findtime"></el-table-column>

      <el-table-column label="任务下发人" prop="xiauser"></el-table-column>
      <el-table-column label="任务下发时间" prop="xiaDate"></el-table-column>
      <el-table-column label="完好率">
        <template slot-scope="scope">
          <el-progress :text-inside="true" :stroke-width="26" :percentage="scope.row.rate" status="exception"></el-progress>
        </template>
      </el-table-column>

      <el-table-column label="缺陷描述" prop="qxmiaoshu"></el-table-column>
    </el-table>


    <!--分页组件-->
    <el-pagination background layout="prev, pager, next" :page-size="size" :total="total" @current-change="handleCurrentChange">
    </el-pagination>
  </div>
</template>

<script>
  export default {
    data() {
      return {


        total: 0,
        size: 3,
        form: {
          rno: '',
          xno: '',
          findin: '',
          findout: '',
          starttime: '',
          stoptime: ''
        },
        options: [{
            lable: '叉梁断裂',
            value: '叉梁断裂'
          }, {
            lable: '拦河线断裂',
            value: '拦河线断裂'
          },
          {
            lable: '绝缘子爆破',
            value: '绝缘子爆破'
          },
          {
            lable: '杆塔倾斜',
            value: '杆塔倾斜'
          },
          {
            lable: '吊杆变形',
            value: '吊杆变形'
          },
          {
            lable: '其他',
            value: '其他'
          }
        ],
        options2: [{
            lable: '一般',
            value: '一般'
          }, {
            lable: '紧急',
            value: '紧急'
          },
          {
            lable: '严重',
            value: '严重'
          }
        ],
        value: '',
        value2: '',
        tableDate: []
      }
    }


    // 显示分页数据代码
    ,
    methods: {
      checkDel({
        row,
        column,
        rowIndex,
        columnIndex
      }) {
        if (this.list[rowIndex].test1 == 1) {
          return 'red'
        }
      },
      handleCurrentChange(c) {
        this.pager(c)
      },
      pager(pageNum) {
        //统一的分页方法
        this.$axios.post("/qx/all", {
            pageNum: pageNum,
            pageSize: this.size
          })
          .then((r) => {
            if (r.status === 200) {
              //如果响应状态返回200，说明一切正常
              this.tableDate = r.data.list; //赋值
              this.total = r.data.total;
            }
          }).catch(e => {
            alert("报错了");
          })
      }
    },
    mounted() {
      //在VUE页面DOM结构渲染完毕，数据加载之前，自动调用的钩子函数
      this.pager(1);
    }
  }
</script>

<style scoped="scoped">
  .el-form .el-form-item {
    display: inline-block;
  }

  .el-table {
    margin-top: -0px;
  }

  .el-row {
    margin-bottom: 20px;

    &:last-child {
      margin-bottom: 0;
    }
  }

  .el-col {
    border-radius: 4px;
  }

  .bg-purple-dark {
    background: #99a9bf;
  }

  .bg-purple-light {
    background: #e5e9f2;
  }

  .grid-content {
    border-radius: 4px;
    min-height: 36px;
  }

  .row-bg {
    padding: 10px 0;
    background-color: #f9fafc;
  }

  .el-table {
    width: 100%;
    margin-top: 15px;
    margin-left: 0px;
  }


  .el-table .red {
    background: #F5F5DC;
  }
</style>
